<!--普通列表-->
<template>
    <div class="content">
    <div v-for="item in storeLists" :key='item.id' class="job-component list box-shadow">
      <div class="store-pic fl" :style="{backgroundImage: 'url(' + (item.storeImg ? item.storeImg : baseImg) + ')', backgroundSize:'contain', backgroundRepeat:'no-repeat', backgroundPosition:'center center'}">
      </div>
      <div class="store-content fl">
        <div class="store-info">
          <p class="store-name fl">{{item.storeName}}</p>
          <p v-if="item.storeType===0" class="store-type fr">直营店</p>
          <p v-if="item.storeType===1" class="store-type fr">加盟店</p>
        </div>
        <div class="store-address">
         {{item.storeAddress}}
        </div>
      </div>
      <div class="store-to fl">
        <a :href="'http://api.map.baidu.com/marker?location='+ltTolg(item.storeXY)+'&title='+item.storeName+'&content='+item.storeAddress+'&output=html'">
          <img src="/static/wechat/images/gotoAddr@2x.png">
          <p>到这里去</p>
        </a>
      </div>
    </div>
    <div :class="addr?'allmap':''" id="allmap"></div>
    </div>

</template>

<script>
  // import BMap from 'BMap';
  import {MP} from '../../common/map.js'
  export default {
    name: 'getStoreList',
    data() {
      return {
        addr:false,
        baseImg:'/static/wechat/images/noImg.png'
      }
    },
    methods: {
      ltTolg(str){
        if(str!=null){
          if(str.indexOf(",")!=-1){
            let lgAndlt=str.split(",");
            let temp = lgAndlt[0];
              lgAndlt[0] = lgAndlt[1];
              lgAndlt[1] = temp;
            return lgAndlt.join();
          }else if(str.indexOf(" ")!=-1){
            let lgAndlt=str.split(" ");
            let temp = lgAndlt[0];
              lgAndlt[0] = lgAndlt[1];
              lgAndlt[1] = temp;
            return lgAndlt.join();
          }
        }
      },
    },
    mounted() {
    },
    props: ["storeLists"]
  }
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
.content {
    width:100%;
    margin:10% auto 18%;
    background:none;
}
.allmap{
    position: fixed!important;
    width: 100%;
    height: 100%;
    top: 0;
    z-index: 999!important;
}
.store-pic{
  height: 40px;
  background:#fff;
}
</style>
